<% content_for :title do %>关键线索<% end %>

<%= link_to '新建关键线索', new_keyword_path,:class=>'btn btn-primary btn-sm' %>


<%= grid(@keywords) do |g|
    g.action_column  object_property: :id
   
    g.column name: '线索名称', attribute: 'name' do |keyword|
      keyword.name
    end

    g.column name: '触发次数', attribute: 'times' do |keyword|
       keyword.times
    end

    g.column name: '创建时间',attribute: 'created_at'  do |keyword|
      time_str keyword.created_at
    end

    g.column name: '最后修改时间',attribute: 'updated_at'  do |keyword|
      time_str keyword.updated_at
    end

     g.column name: '是否启用', attribute: 'usable' do |keyword|
       boolean_label  keyword.usable
    end


     g.column do |keyword| 
      link_to('编辑', edit_keyword_path(keyword))+"  "+link_to('删除', keyword, method: :delete, data: { confirm: 'Are you sure?' })
    end
end %>




